package com.aplink.generic.pojo.controlspec;

import com.aplink.generic.constant.EditTextType;

public class EditTextSpec extends ControlSpec {
    public static final int MIN_LENGTH = 0;
    public static final int MAX_LENGTH = 255;
    private boolean isNoBlank;
    private boolean isReadOnly;
    private boolean isSearch;
    private boolean isNoDuplicate;
    private EditTextType mDataInputType;
    private String mSearchControl;
    private String mSearchField;
    private int mMinLength;
    private int mMaxLength;

    public EditTextSpec( boolean isNoBlank, boolean isReadOnly,
                         boolean isSearch, boolean isNoDuplicate,
                         EditTextType dataInputType, String searchControl,
                         String searchField, int minLength, int maxLength ) {
        this.isNoBlank = isNoBlank;
        this.isReadOnly = isReadOnly;
        this.isSearch = isSearch;
        this.isNoDuplicate = isNoDuplicate;
        mDataInputType = dataInputType;
        mSearchControl = searchControl;
        mSearchField = searchField;
        mMinLength = minLength;
        mMaxLength = maxLength;
    }

    public int getMinLength() {
        return mMinLength;
    }

    public void setMinLength( int minLength ) {
        mMinLength = minLength;
    }

    public int getMaxLength() {
        return mMaxLength;
    }

    public void setMaxLength( int maxLength ) {
        mMaxLength = maxLength;
    }

    public String getSearchControl() {
        return mSearchControl;
    }

    public void setSearchControl( String searchControl ) {
        mSearchControl = searchControl;
    }

    public String getSearchField() {
        return mSearchField;
    }

    public void setSearchField( String searchField ) {
        mSearchField = searchField;
    }

    /**
     * The rule to not allow empty.<br/>
     * This property mapping for "noblank" element.<br/>
     * Example: <noblank/>
     *
     * @return True or False
     */
    public boolean isNoBlank() {
        return isNoBlank;
    }

    /**
     * The rule to not allow empty.<br/>
     * This property mapping for "noblank" element.<br/>
     * Example: <noblank/>
     *
     * @param isNoBlank
     */
    public void setNoBlank( boolean isNoBlank ) {
        this.isNoBlank = isNoBlank;
    }

    /**
     * The rule to set EditText just read only.<br/>
     * This property mapping for "readonly" element. Example: <readonly/>
     *
     * @return True or False.
     */
    public boolean isReadOnly() {
        return isReadOnly;
    }

    /**
     * The rule to set EditText just read only.<br/>
     * This property mapping for "readonly" element. Example: <readonly/>
     *
     * @param isReadOnly
     */
    public void setReadOnly( boolean isReadOnly ) {
        this.isReadOnly = isReadOnly;
    }

    public boolean isSearch() {
        return isSearch;
    }

    public void setSearch( boolean isSearch ) {
        this.isSearch = isSearch;
    }

    public boolean isNoDuplicate() {
        return isNoDuplicate;
    }

    /**
     * @param isNoDuplicate
     */
    public void setNoDuplicate( boolean isNoDuplicate ) {
        this.isNoDuplicate = isNoDuplicate;
    }

    /**
     * The input type of EditText in Android.<br/>
     * This property mapping for "inputtype" attribute.<br/>
     * Example: inputtype="text"
     *
     * @return DataInputType
     */
    public EditTextType getDataInputType() {
        return mDataInputType;
    }

    /**
     * The input type of EditText in Android.<br/>
     * This property mapping for "inputtype" attribute.<br/>
     * Example: inputtype="text"
     *
     * @param dataInputType
     */
    public void setDataInputType( EditTextType dataInputType ) {
        mDataInputType = dataInputType;
    }

    /**
     * The input type of EditText in Android.<br/>
     * This property mapping for "inputtype" attribute.<br/>
     * Example: inputtype="text"
     *
     * @param dataInputTypeName
     */
    public void setDataInputType( String dataInputTypeName ) {
        mDataInputType = EditTextType.get( dataInputTypeName );
    }

}
